//
//  JMSGCustomContentExtension.swift
//  MT
//
//  Created by ooops on 2019/12/22.
//  Copyright © 2019 张强. All rights reserved.
//

import Foundation


extension JMSGCustomContent {
    
    
    /// 获取自定义消息的消息类型
    func customMsgType() -> CustomMessageType {
        if let dict : Dictionary<String, Any> = self.extras as? Dictionary<String, Any> {
            if dict.keys.contains("messageType") {
                if let messageType: CustomMessageType = CustomMessageType(rawValue: dict["messageType"] as! String) {
                    return messageType
                }
                return CustomMessageType(rawValue: "unknow")!
            } else {
                return CustomMessageType(rawValue: "unknow")!
            }
        } else {
            return CustomMessageType(rawValue: "unknow")!
        }
    }
    
}
